package edu.pku.sei.mdabase.infrastructure.event;

import java.util.ArrayList;

public class EventSource {
	private ArrayList<IEventListener> listeners = null;
	
	
	
	public void sendEvent(Object event){
		if(listeners!=null){
			for(IEventListener e : listeners){
				e.receive(event);
			}
		}
	}

	public void regist(IEventListener el){
		if(listeners==null) listeners = new ArrayList<IEventListener>();
		listeners.add(el);
	}
	
	public void deregist(IEventListener el){
		if(listeners!=null)
			listeners.remove(el);
	}
}
